package chapter_18.demo_2;


/**
 * Created by Administrator on 2018/8/7.
 */
public class CalculableLambda2 {
    /**
     * 打印计算结果
     *
     * @param calculable2 Lambda表达式
     * @param n1 操作数1
     * @param n2 操作数2
     */
    public static void display(Calculable2 calculable2, int n1, int n2) {
        System.out.println(calculable2.calculateInt(n1, n2));
    }

    public static void main(String[] args) {

        int n1 = 10;
        int n2 = 5;

        // 打印计算结果加法计算结果
        display((a, b) -> {
            return a + b;
        }, n1, n2);

        // 打印计算结果减法计算结果
        display((a, b) -> a - b, n1, n2);
    }
}
